﻿@model DoAnWebsite.Models.Document
@using Ext.Net
@using Ext.Net.MVC
@{
    ViewBag.Title = "Edit Document";
    Layout = "~/Views/Shared/_Layout_Admin.cshtml";
}

@section Header
{
}
@section ToolbarSection{
    @Html.X().Button().Text("Save").ID("btnSave").Disabled(true).Icon(Icon.Disk).DirectEvents(de =>
            {
                de.Click.IsUpload = true;
                de.Click.Url = Url.Action("EditDocument");
                de.Click.EventMask.ShowMask = true;
                de.Click.FormID = "FormPanelEditDocument";
            })
    
    @Html.X().Button().Text("Back").Icon(Icon.ArrowLeft).Margins("0 0 0 10").Listeners(ls => ls.Click.Handler = "window.parent.location.reload();parentAutoLoadControl.close();")
}

@Html.X().FormPanel().ID("FormPanelEditDocument").Title("Edit Document").StyleSpec("position: static; z-index: 10;width: 100%;").AutoScroll(true).Listeners(
ls => ls.ValidityChange.Handler = "App.btnSave.setDisabled(!valid)").Items(
        Html.X().HiddenFor(m=>m.DocumentId),
        Html.X().ComboBoxFor(m => m.TypeId).FieldLabel("GroupDocument").SelectedItems(Model.TypeId.ToString()).LabelWidth(130).Items(ViewBag.GDocumentId).Width(800).StyleSpec("Margin: 15px 0px 0px 100px"),
        Html.X().TextFieldFor(m => m.Name).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px"),
        Html.X().FileUploadField().FieldLabel("File").Size(108400).ID("UpFile").Value(Model.File).Icon(Icon.ImageAdd).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px"),
        Html.X().HtmlEditorFor(m=>m.Info).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px"),        
        Html.X().ComboBoxFor(m => m.CancerId).FieldLabel("CancerType").SelectedItems(Model.CancerId.ToString()).LabelWidth(130).Items(ViewBag.CancerId).Width(800).StyleSpec("Margin: 15px 0px 0px 100px"),
        Html.X().CheckboxFor(m=>m.Active).LabelWidth(130).StyleSpec("Margin: 15px 0px 30px 100px").Flex(1)
)